# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=flac

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.3.0
pkgrel=2
pkgdesc="Free Lossless Audio Codec (mingw-w64)"
arch=('any')
url="http://flac.sourceforge.net/"
license=('custom:Xiph' 'LGPL' 'GPL' 'FDL')
depends=("${MINGW_PACKAGE_PREFIX}-libogg" "${MINGW_PACKAGE_PREFIX}-gcc-libs")
#optdepends=("${MINGW_PACKAGE_PREFIX}-xmms: for using the xmms plugin")
makedepends=("nasm" "${MINGW_PACKAGE_PREFIX}-gcc")
options=('strip' 'staticlibs')
source=("http://downloads.xiph.org/releases/flac/flac-${pkgver}.tar.xz")
md5sums=('13b5c214cee8373464d3d65dee362cdd')

build() {
  cd "$srcdir/${_realname}-${pkgver}"
  #Required as AM_CONFIG_HEADER is deprecated and causes autotools to error out.
  #sed -i "s/\<AM_CONFIG_HEADER\>/AC_CONFIG_HEADERS/g" configure.in

  touch config.rpath
  #./autogen.sh
  ./configure \
    --enable-shared \
    --enable-static\
    --disable-xmms-plugin \
    --disable-sse \
    --disable-rpath \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --disable-asm-optimizations \
    --with-pic
  make
}

package() {
  cd "$srcdir/${_realname}-${pkgver}"  
  make DESTDIR="$pkgdir" install
}
